home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Business Master (3rd Edition)
/
The Business Master (3rd Edition).iso
/
files
/
wordmisc
/
banner
/
fontcode.bas
< prev
next >
Wrap
BASIC Source File
|
1986-09-06
|
22KB
|
1,055 lines
'FONTCODE.BAS Version 2.1 (C) Copyright 1985, 1986 by Merlin R. Null
'9/6/86
'Requires Microsoft,s QuickBASIC version 2.0 to compile and MASM for
'assembly of the fast video routines. Creates (or decodes) data files
'for use with the FONTSY banner printer from multiple source files
'created with a word processor. This program may not be sold separately
'or as part of any collection of programs or used as an inducement to
'buy any other product or program without the permission of the author:
'Merlin R. Null, P.O. Box 9422, N. Hollywood, CA 91609, (818) 762-1429
DEFINT A-Z
DIM CharCode$(95),Lin$(200),Lin90$(200)
ON ERROR GOTO ErrorHandle
COLOR 11,0
'Check command tail for font name
IF LEN(COMMAND$)=0 THEN
Font$="<none>"
ELSE
NEWFONT$=COMMAND$
CALL MenuScreen
GOTO ReadFont
END IF
MainMenu:
Wdth$="Single"
WColor=11
WMult=1
Hght$="Single"
HtColor=11
HtMult=1
HtDiv=1
COLOR HtColor,0
CALL MenuScreen
LOCATE 4,23
PRINT Font$
LOCATE 6,9
PRINT Title$
LOCATE 7,9
PRINT Comment$
IF Font$="<none>" THEN
CALL Description
ELSE
CALL AvailChars
IF FontContent$="" THEN
LOCATE 11,37
PRINT"<none>"
ELSE
LOCATE 10,1
FOR I=1 TO 133 STEP 66
IF LEN(FontContent$)>I THEN
PRINT TAB(8) MID$(FontContent$,I,65)
END IF
NEXT
END IF
END IF
IF NotSaved THEN
LOCATE 20,36
PRINT"- Not Saved"
END IF
LOCATE 24,34,1
GetOption:
Opt$=INPUT$(1)
NotUsed=0
NumChars=0
IF Opt$="1" THEN 'Option 1. Load an existing font (encoded)
CALL Opt1Prompt
LOCATE 24,24,1
LINE INPUT;NewFont$
ReadFont:
GOSUB ClearFont
500 OPEN Font$ FOR INPUT AS 1
CALL LoadingFont
LINE INPUT #1,Title$
LINE INPUT #1,Comment$
LINE INPUT #1,PrnChar$
LINE INPUT #1,Margin$
LINE INPUT #1,Spacing$
FOR I=1 TO 95
LINE INPUT #1,CharCode$(I)
NEXT
IF NOT EOF(1) THEN
LINE INPUT #1,Init$
LINE INPUT #1,Reset$
INPUT #1,HzMult
INPUT #1,VMult
INPUT #1,Vdiv
END IF
CLOSE
IF HzMult=2 THEN
HzWdth$="Double"
HColor=12
ELSEIF HzMult=3 THEN
HzWdth$="Triple"
HColor=13
ELSE
HzWdth$="Single"
HzMult=1
HColor=11
END IF
IF VMult=2 THEN
VWdth$="Double"
VColor=12
ELSEIF VMult=3 THEN
VWdth$="Triple
VColor=13
ELSEIF VDiv=2 THEN
VWdth$="Half "
VColor=14
ELSE
VWdth$="Single"
VMult=1
VDiv=1
VColor=11
END IF
GOSUB FontContents
CLOSE
GOTO MainMenu
ELSEIF Opt$="2" THEN 'Option 2. Load a full set of font characters
CALL Opt2Prompt
LOCATE 24,18,1
LINE INPUT;NewFont$
GOSUB ClearFont
GOSUB SetDefaults
CALL Opt2Screen
LOCATE 16,34
PRINT Font$;" character #";
FOR Chars=32 TO 126
LOCATE 16,46+LEN(Font$)
PRINT Chars;
GOSUB EncodeChar
NEXT
LOCATE 19,22
PRINT 95-NotUsed;"characters included in ";Font$;
NotSaved=-1
GOSUB FontContents
CALL Hold
GOTO MainMenu
ELSEIF Opt$="3" THEN 'Option 3. Open a new font
CALL Opt3Screen
LOCATE 24,13,1
LINE INPUT;NewFont$
GOSUB ClearFont
GOSUB SetDefaults
GOSUB FontContents
NotSaved=-1
GOTO MainMenu
ELSEIF Font$="<none>" AND Opt$>"3" AND Opt$<"9" THEN
LOCATE 23,1
COLOR 12,0
PRINT"A font must be loaded or a new one opened to use option ";Opt$
COLOR 11,0
BEEP
CALL Hold
GOTO MainMenu
'Option 4. Load a single font character
ELSEIF Opt$="4" THEN
LoadChar:
CALL Opt4Screen
WhatChar:
LOCATE 24,1,1
PRINT"Enter the character you wish to add to ";Font$;" ";
Char$=INPUT$(1)
IF Char$<" " OR Char$>"~" THEN
GOSUB FontContents
GOTO MainMenu
ELSE
PRINT Char$;
END IF
Chars=ASC(Char$)
'define scroll window in assembly values
ULCorner=&H0800 'row 8 col 0
LRCorner=&H174F 'row 23 col 79
CALL WindowScroll (ULCorner,LRCorner)
LOCATE 24,1
PRINT"Adding ";Font$;" character #";Chars;
GOSUB EncodeChar
IF NotUsed>0 THEN
BEEP
CALL WindowScroll (ULCorner,LRCorner)
LOCATE 24,1
COLOR 12,0
PRINT"Source file ";CharIn$;" not found";
COLOR 11,0
END IF
CALL WindowScroll (ULCorner,LRCorner)
NotUsed=0
NotSaved=-1
GOTO WhatChar
'Option 5. Unload a single character to a text file
ELSEIF Opt$="5" THEN
UnloadChar:
CALL Opt5Screen
'define scroll window in assembly values
ULCorner=&H0900 'row 9 col 0
LRCorner=&H174F 'row 23 col 79
UnloadOne:
LOCATE 24,1,1
PRINT"Character to unload from ";Font$" : ";
Char$=INPUT$(1)
IF Char$<" " OR Char$>"~" THEN
GOTO MainMenu
ELSE
PRINT Char$;
END IF
CALL WindowScroll (ULCorner,LRCorner)
LOCATE 24,1
Char=ASC(Char$)
CH=Char-31
OutFont$=Font$
IF CharCode$(CH)<>"" THEN
PRINT"Unloading character: ";Char;
GOSUB WriteCharFile
ELSE
BEEP
PRINT"Not Included in ";Font$;
END IF
CALL WindowScroll (ULCorner,LRCorner)
GOTO UnloadOne
' Option 6. Unload all of a current font to text files
ELSEIF Opt$="6" THEN
CALL Opt6Screen
LOCATE 6,42
PRINT Font$;
LOCATE 13,36
PRINT Hght$
LOCATE 15,36
COLOR WColor,0
PRINT Wdth$
COLOR 11,0
Done=0
WHILE NOT Done
LOCATE 24,34,1
Opt6$=INPUT$(1)
IF Opt6$=CHR$(27) OR Opt6$=chr$(3) THEN
GOTO MainMenu
ELSEIF Opt6$="1" THEN
IF HtDiv=2 THEN
HtDiv=1
Hght$="Single"
HtColor=11
ELSEIF HtMult=1 THEN
HtMult=2
Hght$="Double"
HtColor=12
ELSEIF HtMult=2 THEN
HtMult=3
Hght$="Triple"
HtColor=13
ELSEIF HtMult=3 THEN
HtMult=1
HtDiv=2
Hght$="Half "
HtColor=14
END IF
LOCATE 13,36
COLOR HtColor,0
PRINT Hght$
COLOR 11,0
ELSEIF Opt6$="2" THEN
IF WMult=1 THEN
WMult=2
Wdth$="Double"
WColor=12
ELSEIF WMult=2 THEN
WMult=3
Wdth$="Triple"
WColor=13
ELSE
WMult=1
Wdth$="Single"
WColor=11
END IF
LOCATE 15,36
COLOR WColor,0
PRINT Wdth$
COLOR 11,0
ELSEIF Opt6$=CHR$(13) THEN
Done=-1
END IF
WEND
Done=0
WHILE NOT Done
IF HtMult<>1 OR WMult<>1 OR HtDiv<>1 THEN
CALL ClearToEOS (20)
LOCATE 24,1
LINE INPUT;"Output Font Name ? ";OutFont$
IF OutFont$="" THEN
GOTO MainMenu
ELSEIF OutFont$<>Font$ THEN
Done=-1
END IF
ELSE
OutFont$=Font$
DONE=-1
END IF
WEND
IF INSTR(OutFont$,".")=0 THEN
OutFont$=OutFont$+".FNT"
END IF
CALL ClearToEOS (11)
CALL Opt6aScreen
LOCATE 13,42
PRINT LEFT$(OutFont$,INSTR(OutFont$,"."))
FOR CH=1 TO 95
IF CharCode$(CH)<>"" THEN
Char=CH+31
LOCATE 20,45
PRINT Char;
GOSUB WriteCharFile
END IF
NEXT
PRINT
GOTO MainMenu
ELSEIF Opt$="7" THEN 'Option 7. Save current font
CALL ClearToEOS (13)
LOCATE 18,20
PRINT"Save the current font"
LOCATE 21,1
FontBak$=LEFT$(Font$,INSTR(Font$,"."))+"BAK"
1600 OPEN Font$ FOR INPUT AS 1 'See if output font already exists
CLOSE 'Close, if found, else error trap gets it
RenameFont=-1
1700 OPEN FontBak$ FOR INPUT AS 1 'See if <fontname>.BAK exists.
CLOSE 'Close, if found, else error trap gets it
PRINT"Erasing ";FontBak$
KILL FontBak$
NewBakFile:
IF RenameFont THEN
PRINT"Changing ";Font$;" to ";FontBak$
NAME Font$ AS FontBak$
END IF
PRINT"Writing ";Font$
OPEN Font$ FOR OUTPUT AS 1
PRINT #1,Title$
PRINT #1,Comment$
PRINT #1,PrnChar$
PRINT #1,Margin$
PRINT #1,Spacing$
FOR J=1 TO 95
PRINT #1,CharCode$(J)
NEXT
PRINT #1,Init$
PRINT #1,Reset$
PRINT #1,HzMult
PRINT #1,VMult
PRINT #1,Vdiv
CLOSE
NotSaved=0
CALL Hold
GOTO MainMenu
ELSEIF Opt$="8" THEN 'Option 8. Change font defaults
GOSUB SetDefaults
NotSaved=-1
GOTO MainMenu
ELSEIF Opt$="9" THEN 'Option 9. Modify font text files
OptIn9:
NumFiles=0
CALL Opt9Screen
LOCATE 18,27,1
GetOpt9:
Opt9$=INPUT$(1)
IF Opt9$=CHR$(3) OR Opt9$=CHR$(27) THEN
GOTO MainMenu
ELSEIF Opt9$<"1" OR Opt9$>"6" THEN
BEEP
GOTO GetOpt9
END IF
PRINT Opt9$;
CALL InFilePrompt
LOCATE 20,39
LINE INPUT CharIn$
IF CharIn$="" THEN
GOTO OptIn9
END IF
CALL OutFilePrompt
LOCATE 22,40
LINE INPUT CharOut$
IF CharOut$="" THEN
GOTO OptIn9
ELSEIF CharOut$=CharIn$ THEN
BEEP
CALL InEquOut
CALL Hold
GOTO OptIn9
END IF
IF OPT9$<"4" THEN
2400 OPEN CharOut$ FOR INPUT AS 1
CLOSE
CALL OvrWrtPrmpt
LOCATE 24,31,1
Ans$=INPUT$(1)
IF LEFT$(Ans$,1)<>"Y" AND LEFT$(Ans$,1)<>"y" THEN
GOTO OptIn9
END IF
NoOutFile:
StartLine=19
CALL ClearToEOS (StartLine)
LOCATE 20,1
PRINT"Reading ";CharIn$
GOSUB ReadInputChar
IF SkipFlag THEN
BEEP
COLOR 12,0
LOCATE 20,1
PRINT CharIn$;" not found"
COLOR 11,0
CALL Hold
SkipFlag=0
GOTO OptIn9
END IF
LOCATE 22,1
PRINT"Writing ";CharOut$
ELSE
IF INSTR(CharIn$,".")=0 THEN
CharIn$=CharIn$+"."
END IF
IF INSTR(CharOut$,".")=0 THEN
CharOut$=CharOut$+"."
END IF
IF LEFT$(CharIn$,INSTR(CharIn$,"."))=_
LEFT$(CharOut$,INSTR(CharOut$,".")) THEN
BEEP
CALL InEquOut
CALL Hold
GOTO OptIn9
END IF
StartLine=19
CALL ClearToEOS (StartLine)
LOCATE 20,21
PRINT"Working on :";
FOR CH=1 TO 95
Char=CH+31
Ext$=MID$(STR$(Char),2)
IF LEN(Ext$)=2 THEN
Ext$="0"+Ext$
END IF
CharIn$=LEFT$(CharIn$,INSTR(CharIn$,"."))+Ext$
CharOut$=LEFT$(CharOut$,INSTR(CharOut$,"."))+Ext$
3000 OPEN CharOut$ FOR INPUT AS 1
CLOSE
BEEP
CALL OvrWrtPrmpt
LOCATE 24,31,1
Ans$=INPUT$(1)
IF LEFT$(Ans$,1)<>"Y" AND LEFT$(Ans$,1)<>"y" THEN
GOTO Skipchar
END IF
NoOldFile:
LOCATE 20,34
PRINT CharIn$;" ===> ";CharOut$;
GOSUB ReadInputChar
IF NOT SkipFlag THEN
IF Opt9$="4" THEN
GOSUB Rotate180
ELSEIF Opt9$="5" THEN
GOSUB Rotate90
ELSEIF Opt9$="6" THEN
GOSUB FlipFile
END IF
ELSE
SkipFlag=0
END IF
SkipChar:
Quit$=INKEY$
IF Quit$<>"" THEN
GOSUB BailOut
END IF
NEXT
IF Numfiles=0 THEN
COLOR 12,0
LOCATE 22,28
PRINT"No source files located"
BEEP
COLOR 11,0
ELSE
LOCATE 22,30
PRINT Numfiles;" Files created."
END IF
END IF
IF Opt9$="1" THEN
GOSUB Rotate180
ELSEIF Opt9$="2" THEN
GOSUB Rotate90
ELSEIF Opt9$="3" THEN
GOSUB FlipFile
END IF
CALL Hold
GOTO OptIn9
ELSEIF Opt$=CHR$(27) OR Opt$=CHR$(3) THEN ' <Esc> to Exit
IF NotSaved THEN
StartLine=22
CALL ClearToEOS (StartLine)
LOCATE 24,1,1
PRINT"Abandon modified font: ";Font$;" (Y/N) ? ";
Ans$=INPUT$(1)
IF Ans$<>"Y" AND Ans$<>"y" THEN
GOTO MainMenu
END IF
END IF
GOTO Finish
END IF
GOTO GetOption
Finish:
CLS
END
ReadInputChar:
4000 OPEN CharIn$ FOR INPUT AS 1
OPEN CharOut$ FOR OUTPUT AS 2
NumFiles=Numfiles+1
FOR I=1 TO 200
Lin$(I)=""
NEXT
Row=0
MaxLen=0
FOR I=1 TO 200
LIN$(I)=""
NEXT
DONE=0
WHILE NOT Done
Row=Row+1
LINE INPUT #1,LIN$(Row)
IF LEN(Lin$(Row))>MaxLen THEN
MaxLen=LEN(LIN$(Row))
END IF
IF Row=200 OR EOF(1) THEN
DONE=-1
END IF
WEND
CLOSE #1
NoChar:
RETURN
Rotate180: 'Option 9.1 & 9.4 write 180 degree rotated file
FOR I=1 TO Row
Lin$(I)=Lin$(I)+STRING$(MaxLen-LEN(Lin$(I)),32)
NEXT
FOR I=Row TO 1 STEP -1
FOR K=1 TO LEN(Lin$(I))
IF MID$(LIN$(I),K,1)<> " " THEN
Blank=K
K=LEN(Lin$(I))
END IF
NEXT
FOR J=LEN(Lin$(I)) TO 1 STEP -1
Temp$=Temp$+MID$(Lin$(I),J,1)
NEXT
Temp$=LEFT$(Temp$,LEN(Temp$)-(Blank-1))
PRINT #2,Temp$
Temp$=""
NEXT
CLOSE
RETURN
Rotate90: 'Option 9.2 & 9.5 write file rotated 90 degrees clockwise
FOR I=1 TO 200
Lin90$(I)=""
NEXT
ChrStart=0
FOR I=Row TO 1 STEP -1
FOR K=1 TO MaxLen
IF LEN(Lin$(I))<K THEN
Lin90$(K)=Lin90$(K)+" "
ELSE
Lin90$(K)=Lin90$(K)+MID$(Lin$(I),K,1)
END IF
NEXT
NEXT
FOR I=1 TO MaxLen
IF NOT ChrStart THEN
IF Lin90$(I) <> STRING$(LEN(lin90$(I)),32) THEN
ChrStart=-1
END IF
END IF
IF ChrStart THEN
FOR J=LEN(Lin90$(I)) TO 1 STEP -1
IF MID$(Lin90$(I),J,1)<>" " THEN
StringEnd=J
J=1
END IF
NEXT
PRINT #2,LEFT$(Lin90$(I),StringEnd)
END IF
NEXT
CLOSE
RETURN
FlipFile: 'Option 9.3 & 9.6 write inverted line order file
FOR I=Row TO 1 STEP -1
PRINT #2,Lin$(I)
NEXT
CLOSE
RETURN
FontContents:
FontContent$=""
FOR I=1 TO 95
IF I=1 AND CharCode$(I)<>"" THEN
FontContent$="space "
ELSEIF CharCode$(I)<>"" THEN
FontContent$=FontContent$+CHR$(I+31)+" "
END IF
NEXT
RETURN
EncodeChar: 'Encode character text file subroutine
TMP$=""
Extension$=MID$(STR$(Chars),2)
IF LEN(Extension$)<3 THEN
Extension$="0"+Extension$
END IF
CharIn$=LEFT$(Font$,INSTR(Font$,"."))+Extension$
Quit$=INKEY$
IF Quit$<>"" THEN
GOSUB BailOut
END IF
5000 OPEN CharIn$ FOR INPUT AS 2
FOR Lines=1 TO 200
LINE INPUT #2,Txt$
COL=0:SEGLEN=0
FOR Char=LEN(Txt$) TO 1 STEP -1
IF MID$(Txt$,Char,1)<>" "AND MID$(Txt$,Char,1)<>CHR$(9) THEN
GOTO CharLoop
END IF
NEXT
Tmp$=Tmp$+CHR$(255) ' found a blank line
GOTO EofCheck
CharLoop:
FOR Byte=1 TO Char
IF SEGLEN=95 THEN
Tmp$=Tmp$+CHR$(127)
SEGLEN=0
END IF
Byte$=MID$(Txt$,Byte,1)
IF Byte$=CHR$(9) THEN
Col=Col+8-(Col MOD 8)
ELSE
Col=Col+1
END IF
IF SegLen=0 THEN
IF Byte$<>" " AND Byte$<>CHR$(9) THEN
Tmp$=Tmp$+CHR$(Col+31)
END IF
END IF
IF Byte$<>" " AND Byte$<>CHR$(9) THEN
SegLen=SegLen+1
END IF
IF SegLen<>0 THEN
IF Byte$=" " OR Byte$=CHR$(9) THEN
Tmp$=Tmp$+CHR$(SegLen+32)
SegLen=0
END IF
END IF
NEXT
Tmp$=Tmp$+CHR$(SegLen+160)
EofCheck:
IF EOF(2) THEN
GOTO LoadArrayElement
END IF
NEXT
LoadArrayElement:
CharCode$(Chars-31)=Tmp$
DoNextChar:
CLOSE
RETURN
ClearFont: 'New font subroutine
IF NewFont$<>CHR$(255) THEN
IF NewFont$="" THEN
GOTO MainMenu
ELSEIF NotSaved THEN
StartLine=22
CALL ClearToEOS (StartLine)
LOCATE 24,1,1
PRINT"Abandon modified font: ";Font$;" (Y/N) ? ";
Ans$=INPUT$(1)
IF Ans$<>"Y" AND Ans$<>"y" THEN
GOTO MainMenu
END IF
END IF
IF INSTR(NewFont$,".")=0 THEN
NewFont$=NewFont$ + ".FNT"
END IF
Font$=NewFont$
ELSE
Font$="<none>"
END IF
Title$=""
Comment$=""
PrnChar$=""
Margin$=""
Spacing$=""
FOR I=1 TO 95
CharCode$(I)=""
NEXT
NotSaved=0
RETURN
BailOut: 'Quit current function subroutine
IF Quit$=CHR$(27) OR Quit$=CHR$(3) THEN
CLOSE
BEEP
CALL Abort
CALL Hold
GOTO MainMenu
END IF
RETURN
WriteCharFile: 'Write large character text file subroutine
CodeLen=LEN(CharCode$(CH))
IF CodeLen<>0 THEN
Ext$=MID$(STR$(Char),2)
IF LEN(Ext$)=2 THEN
Ext$="0"+Ext$
END IF
CharOut$=LEFT$(OutFont$,INSTR(OutFont$,"."))+Ext$
OPEN CharOut$ FOR OUTPUT AS 1
FOR Byte=1 TO CodeLen STEP 2
LineFlag=0
IF MID$(CharCode$(CH),Byte,1)=CHR$(255) THEN
FOR I=1 TO WMult
PRINT #1,""
NEXT
Byte=Byte-1
ELSE
Segment=Segment+1
Column=ASC(MID$(CharCode$(CH),Byte,1))-31
Length=ASC(MID$(CharCode$(CH),Byte+1,1))
IF Length>127 THEN
Length=Length-128
LineFlag=-1
END IF
Length=Length-32
PRINT #1,TAB((Column*HtMult)/HtDiv)_
STRING$((Length*HtMult)/HtDiv,PrnChar$);
IF LineFlag THEN
PRINT #1,""
NumRows=NumRows+1
IF NumRows<WMult THEN
Byte=Byte-(Segment*2)
ELSE
NumRows=0
END IF
Segment=0
END IF
END IF
NEXT
CLOSE #1
Quit$=INKEY$
IF Quit$<>"" THEN
GOSUB BailOut
END IF
END IF
RETURN
SetDefaults: 'Set font defaults subroutine
CALL SetDef1Screen
LOCATE 7,5
PRINT Title$
LOCATE 24,9,1
LINE INPUT;Temp$
IF Temp$="" AND Title$="" OR LEN(Temp$)>70 THEN
BEEP
GOTO SetDefaults
END IF
IF Temp$<>"" THEN
Title$=Temp$
END IF
EnterComment:
CALL SetDef2Screen
LOCATE 7,5
PRINT Comment$
LOCATE 24,11,1
LINE INPUT;Temp$
IF LEN(Temp$)>70 THEN
BEEP
GOTO EnterComment
ELSEIF Temp$="999" THEN
Comment$=""
ELSEIF Temp$<>"" THEN
Comment$=Temp$
END IF
PrintChar:
CALL SetDef3Screen
IF PrnChar$="" THEN
PrnChar$="@"
END IF
LOCATE 7,37
IF PrnChar$=CHR$(255) THEN
PRINT" Variable"
ELSEIF PrnChar$<"!" OR PrnChar$>"~" THEN
PRINT ASC(PrnChar$);"Decimal";
ELSE
PRINT" ";PrnChar$;" -";ASC(PrnChar$);"Decimal";
END IF
LOCATE 24,31,1
LINE INPUT;NewPrnChar$
IF LEN(NewPrnChar$)>1 THEN
FOR I=1 TO LEN(NewPrnChar$)
IF MID$(NewPrnChar$,I,1)<"0" OR MID$(NewPrnChar$,I,1)>"9" THEN
BEEP
GOTO PrintChar
END IF
NEXT
IF VAL(NewPrnChar$)>255 THEN
BEEP
GOTO PrintChar
ELSE
PrnChar$=CHR$(VAL(NewPrnChar$))
END IF
ELSEIF NewPrnChar$<>"" THEN
PrnChar$=NewPrnChar$
END IF
SetMargin:
CALL SetDef4Screen
IF Margin$="" THEN
Margin$="1"
END IF
LOCATE 7,40
PRINT Margin$
LOCATE 24,28,1
LINE INPUT;NewMargin$
FOR I=1 TO LEN(NewMargin$)
IF MID$(NewMargin$,I,1)<"0" OR MID$(NewMargin$,I,1)>"9" THEN
BEEP
GOTO SetMargin
END IF
NEXT
IF VAL(NewMargin$)>230 THEN
BEEP
GOTO SetMargin
END IF
IF NewMargin$<>"" THEN
Margin$=NewMargin$
END IF
SetSpacing:
CALL SetDef5Screen
IF Spacing$="" THEN
Spacing$="3"
END IF
LOCATE 7,40
PRINT Spacing$
LOCATE 24,18,1
LINE INPUT;NewSpacing$
IF LEN(NewSpacing$)>2 THEN
BEEP
GOTO SetSpacing
END IF
FOR I=1 TO LEN(NewSpacing$)
IF MID$(NewSpacing$,I,1)<"0" OR MID$(NewSpacing$,I,1)>"9" THEN
BEEP
GOTO SetSpacing
END IF
NEXT
IF NewSpacing$<>"" THEN
Spacing$=NewSpacing$
END IF
'Set printer initialization & reset strings
CALL SetDef6Screen
GOSUB InitSet
IF Dec$="999" THEN
Init$=""
NotSaved=-1
ELSEIF PrnInit$<>"" THEN
Init$=PrnInit$
NotSaved=-1
END IF
CALL SetDef7Screen
GOSUB InitSet
IF Dec$="999" THEN
Reset$=""
NotSaved=-1
ELSEIF PrnInit$<>"" THEN
Reset$=PrnInit$
NotSaved=-1
END IF
'Set horizontal & vertical magnification factors
CALL SetDef8Screen
LOCATE 24,15,1
IF HzMult=0 THEN
HzWdth$="Single"
HzMult=1
HColor=11
VWdth$="Single"
VColor=11
Vdiv=1
VMult=1
END IF
DONE=0
WHILE NOT Done
LOCATE 16,53
COLOR HColor,0
PRINT HzWdth$;
LOCATE 19,53
COLOR VColor,0
PRINT VWdth$;
COLOR 11,0
LOCATE 24,22,1
Temp$=INPUT$(1)
IF Temp$=CHR$(13) THEN
DONE=-1
ELSEIF Temp$="1" THEN
IF HzMult=3 THEN
HzWdth$="Single"
HzMult=1
HColor=11
ELSEIF HzMult=1 THEN
HzWdth$="Double"
HzMult=2
HColor=12
ELSE
HzWdth$="Triple"
HzMult=3
HColor=13
END IF
ELSEIF Temp$="2" THEN
IF VDiv=2 THEN
VWdth$="Single"
VColor=11
Vdiv=1
ELSEIF VMult=1 THEN
VWdth$="Double"
VMult=2
VColor=12
ELSEIF VMult=2 THEN
VWdth$="Triple"
VMult=3
VColor=13
ELSE
VWdth$="Half "
VMult=1
VDiv=2
VColor=14
END IF
ELSE
BEEP
END IF
WEND
RETURN
InitSet: 'Enter printer initialization or reset strings
K=0
LOCATE 16,1
PrnInit$=""
Dec$="0"
WHILE Dec$<>""
BadVal=0
K=K+1
PRINT"Decimal value for byte #";K;": ";
LINE INPUT Dec$
IF LEN(Dec$)>3 THEN
BEEP
BadVal=-1
K=K-1
ELSEIF Dec$<>"" THEN
FOR J=1 TO LEN(Dec$)
IF MID$(Dec$,J,1)<"0" OR MID$(Dec$,J,1)>"9" THEN
BEEP
J=LEN(Dec$)
BadVal=-1
K=K-1
END IF
NEXT
IF Dec$="999" THEN
PrnInit$=""
ELSEIF VAL(Dec$)>255 THEN
BEEP
K=K-1
ELSEIF NOT BadVal THEN
PrnInit$=PrnInit$+CHR$(VAL(Dec$))
END IF
END IF
WEND
RETURN
ErrorHandle:
IF ERR=53 AND ERL=5000 THEN
NotUsed=NotUsed+1
IF NotUsed=95 THEN
COLOR 12,0
CALL NoFiles
LOCATE 4,39
PRINT Font$;"!";
NotSaved=0
ELSE
RESUME DoNextChar 'encode character subroutine
END IF
ELSEIF ERR=53 AND ERL=1600 THEN
CLOSE
RESUME 1700
ELSEIF ERR=53 AND ERL=1700 THEN
CLOSE
RESUME NewBakFile
ELSEIF ERR=53 AND ERL=2400 THEN
CLOSE
RESUME NoOutFile
ELSEIF ERR=53 AND ERL=500 OR ERR=76 AND ERL=500 THEN
CLOSE
LOCATE 23,1
COLOR 12,0
PRINT"Encoded font ";Font$;" not found.";
ELSEIF ERR=53 AND ERL=3000 THEN
CLOSE
RESUME NoOldFile
ELSEIF ERL=4000 THEN
SkipFlag=-1
RESUME NoChar
ELSEIF ERL=2400 THEN
IF ERR=52 OR ERR=64 OR ERR=75 OR ERR=76 THEN
COLOR 12,0
PRINT"Bad Filename or Path"
COLOR 11,0
BEEP
CALL Hold
RESUME OptIn9
END IF
ELSEIF ERR=52 OR ERR=64 OR ERR=75 OR ERR=76 THEN
CLS
CALL MenuScreen
LOCATE 23,1
COLOR 12,0
PRINT"Bad font name or path";
ELSE
ON ERROR GOTO 0
END IF
BEEP
COLOR 11,0
CALL Hold
NewFont$=CHR$(255)
GOSUB ClearFont
RESUME MainMenu